package pentago.main;

import java.awt.Font;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
import javax.swing.UIManager;

@SuppressWarnings("serial")
public class HelpDialog extends JDialog {

    private final JPanel contentPanel = new JPanel();
    private JPanel buttonPane;
    private JLabel lblZasadyGry;

    /**
     * Create the dialog.
     */
    public HelpDialog() {
	setTitle("Pomoc");
	setResizable(false);
	setBounds(100, 100, 566, 372);
	contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
	contentPanel
		.setLayout(new FormLayout(new ColumnSpec[] {
			ColumnSpec.decode("max(78dlu;default)"),
			ColumnSpec.decode("127dlu"),
			ColumnSpec.decode("max(135dlu;default)"), },
			new RowSpec[] { FormFactory.UNRELATED_GAP_ROWSPEC,
				RowSpec.decode("16px"),
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC, }));
	{
	    JLabel lblInformacjeOGrze = new JLabel(
		    "Informacje o grze i autorach:");
	    lblInformacjeOGrze.setHorizontalAlignment(SwingConstants.CENTER);
	    contentPanel.add(lblInformacjeOGrze, "2, 2, center, top");
	}
	{
	    JLabel lblNewLabel = new JLabel(
		    "Joann Zakrzewska, Pawe\u0142 Winogrodzki");
	    lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
	    contentPanel.add(lblNewLabel, "2, 4, fill, default");
	}
	{
	    buttonPane = new JPanel();
	    buttonPane.setLayout(new FormLayout(new ColumnSpec[] {
		    ColumnSpec.decode("226px"), ColumnSpec.decode("331px"), },
		    new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC,
			    RowSpec.decode("25px"), }));
	}
	{
	    lblZasadyGry = new JLabel("Zasady gry:");
	    lblZasadyGry.setHorizontalAlignment(SwingConstants.CENTER);
	}

	JTextArea txtrKadyZGraczy = new JTextArea();
	txtrKadyZGraczy.setBackground(UIManager.getColor("Button.background"));
	txtrKadyZGraczy.setFont(new Font("Tahoma", Font.PLAIN, 13));
	txtrKadyZGraczy.setWrapStyleWord(true);
	txtrKadyZGraczy.setTabSize(15);
	txtrKadyZGraczy.setRows(15);
	txtrKadyZGraczy.setEditable(false);
	txtrKadyZGraczy
		.setText("Ka\u017Cdy z graczy naprzemiennie MUSI wstawi\u0107 w wolne miejsce na planszy JEDN\u0104\r\nkulk\u0119 i wykona\u0107 obr\u00F3t o 90 stopni DOWOLN\u0104 \u0107wiartk\u0105 planszy (w dowolnej kolejno\u015Bci). \r\nGra si\u0119 ko\u0144czy w momencie gdy minimum pi\u0119\u0107 kulek jednego z graczy utworzy prost\u0105 lini\u0119.  \r\nGracz, do kt\u00F3rego nale\u017Ca\u0142y te kulki wygrywa. W przypadku ko\u0144czenia gry nie jest \r\nwymagane jednoczesne wykonanie obr\u00F3cenie planszy i do\u0142o\u017Cenie kulki. W przypadku \r\ngdy po obrocie planszy kulki obu graczy utworz\u0105 prost\u0105 lini\u0119 conajmniej pi\u0119ciu kulek,\r\nb\u0105d\u017A zabraknie mniejsca na planszy, by dok\u0142ada\u0107 kolejne, to gra ko\u0144czy si\u0119 remisem.");
	GroupLayout groupLayout = new GroupLayout(getContentPane());
	groupLayout.setHorizontalGroup(groupLayout
		.createParallelGroup(Alignment.LEADING)
		.addComponent(buttonPane, GroupLayout.DEFAULT_SIZE, 560,
			Short.MAX_VALUE)
		.addGroup(
			Alignment.TRAILING,
			groupLayout
				.createSequentialGroup()
				.addGap(12)
				.addComponent(txtrKadyZGraczy,
					GroupLayout.PREFERRED_SIZE, 524,
					Short.MAX_VALUE).addContainerGap())
		.addComponent(contentPanel, GroupLayout.PREFERRED_SIZE, 564,
			Short.MAX_VALUE)
		.addGroup(
			groupLayout
				.createSequentialGroup()
				.addGap(197)
				.addComponent(lblZasadyGry,
					GroupLayout.PREFERRED_SIZE, 168,
					GroupLayout.PREFERRED_SIZE)
				.addContainerGap(325, Short.MAX_VALUE)));
	groupLayout.setVerticalGroup(groupLayout.createParallelGroup(
		Alignment.LEADING).addGroup(
		groupLayout
			.createSequentialGroup()
			.addComponent(contentPanel, GroupLayout.PREFERRED_SIZE,
				GroupLayout.DEFAULT_SIZE,
				GroupLayout.PREFERRED_SIZE)
			.addPreferredGap(ComponentPlacement.RELATED)
			.addComponent(lblZasadyGry)
			.addGap(26)
			.addComponent(txtrKadyZGraczy,
				GroupLayout.PREFERRED_SIZE, 129,
				GroupLayout.PREFERRED_SIZE)
			.addGap(42)
			.addComponent(buttonPane, GroupLayout.DEFAULT_SIZE, 84,
				Short.MAX_VALUE).addContainerGap()));
	{
	    JLabel lblPozna = new JLabel("Pozna\u0144, 2012-2013");
	    lblPozna.setHorizontalAlignment(SwingConstants.CENTER);
	    contentPanel.add(lblPozna, "2, 6, fill, center");
	}
	getContentPane().setLayout(groupLayout);
    }
}
